<?php

namespace app\flash\behavior;

use think\Response;

class CORS
{
    public function appInit(&$params)
    {
        header('Access-Control-Allow-Origin: *');
        //header('Access-Control-Allow-Origin: http://localhost:8080/');
        //header("Access-Control-Allow-Headers: token,Origin, X-Requested-With, Content-Type, Accept");
        header("Access-Control-Allow-Headers: *");
        header('Access-Control-Allow-Methods: POST,GET');
        //header('Access-Control-Allow-Credential:true');//表示是否允许发送Cookie
        if (request()->isOptions()) {
            exit();
        }
    }
}